package page2;

import java.util.Scanner;

public class Ques1461 {
	
	int n;
	int index;
	
	public void fi(int num1,int num2){
		n = n - num2;
		index++;
		if(n < (num1 + num2)){
			return;
		}
		fi(num2,num1 + num2);
	}
	
	public void go(){
		Scanner scan = new Scanner(System.in);
		int T = scan.nextInt();
		while(T-- > 0){
			n = scan.nextInt();
			index = 0;
			this.fi(0, 1);
			System.out.println(index);
		}
	}
	
	public static void main(String[] args) {
		new Ques1461().go();
	}
}
